﻿
@{
    ViewBag.Title = "Form";
    Layout = "~/Views/Shared/_Form.cshtml";
}
<style>
    .form .formValue input.form-control {
        height: 34px;
        line-height: 34px;
    }

    .form-control {
        padding: 0px;
    }

    .Table {
        width: 100%;
        margin: 0px;
        padding: 0px;
        border-collapse: collapse;
        border-width: 3px 1px 1px;
        table-layout: fixed;
    }

    .form .formTitle {
        width: 80px;
    }

    .form .formValue textarea.form-control {
        width: 99%;
    }
</style>
<script>
    var orderId = $.request("orderId");
    var F_Id = $.request("F_Id");
    var F_CheckId = $.request("F_CheckId");
    var F_FlowId = $.request("F_FlowId");
    var ApplyType = $.request("ApplyType");
    var F_CheckUserId = $.request("F_CheckUserId");
    var resultData = {};
    $(function () {
        getItemList();
    });

    function getItemList() {
        resultData = getCache("CHECK_COMFORM");
        if (!resultData || resultData.length <= 0) {
            $.ajax({
                url: "/CheckManager/CheckInfos//GetItemList",
                dataType: "json",
                async: false,
                success: function (data) {
                    if (data.wdqly.length > 0) {
                        for (var i = 0; i < data.wdqly.length; i++) {
                            $("#F_Reason").append("<option value='" + data.wdqly[i].F_ItemCode + "'>" + data.wdqly[i].F_ItemName + "</option>");
                        }
                    }
                    resultData = data;
                    setCache("CHECK_COMFORM", data);
                }, error: function (XMLHttpRequest, textStatus, errorThrown) {

                }
            });
        } else {
            var data = resultData;
            if (data.wdqly.length > 0) {
                for (var i = 0; i < data.wdqly.length; i++) {
                    $("#F_Reason").append("<option value='" + data.wdqly[i].F_ItemCode + "'>" + data.wdqly[i].F_ItemName + "</option>");
                }
            }
        }

    }

    function submitForm() {
        var stateValue = $("input[name='F_State']:checked").val();
        if (stateValue == '' || stateValue == null) {
            return;
        }
        debugger
        $.submitForm({
            url: "/OrderFlowManage/ClientOrder/SubmitReturnVisit",
            param: {
                F_State: stateValue,
                F_InvalidReason: $("input[name='F_InvalidReason']:checked").val(),
                F_Mark: $("#F_Mark").val(),
                F_OrderId: orderId,
            },
            success: function () {
                var frame = top.frames;
                frame.$("#btn_search").click();
                frame.$('#loadingPage').remove();
            }
        });
    }
</script>
<div id="ProjectsDetail">
    <form id="projectForm">
        <table class="form">
            <tr>
                <td colspan="6">
                    <table class="Table">
                        <tr>
                            <td class="formTitle">需求状态
                            <td class="formValue" colspan="5">
                                <input type="radio" name="F_State" value="1" />有效 <input type="radio" name="F_State" value="0" />无效
                            </td>
                        </tr>
                        <tr id="tr_reason" style="display:none;">
                            <td class="formTitle" style="color:red;">无效理由*</td>
                            <td class="formValue" colspan="5">
                                <input type="radio" name="F_InvalidReason" value="1" />客户不提供活动详细信息
                                <input type="radio" name="F_InvalidReason" value="2" />联系不到客户
                                <input type="radio" name="F_InvalidReason" value="3" />预算太低
                                <br />
                                <input type="radio" name="F_InvalidReason" value="4" />客户选择其他场地
                                <input type="radio" name="F_InvalidReason" value="5" />无场地推荐
                                <input type="radio" name="F_InvalidReason" value="6" />比稿失败
                                <br />
                                <input type="radio" name="F_InvalidReason" value="7" />客户跳单
                                <input type="radio" name="F_InvalidReason" value="8" />活动取消
                                <input type="radio" name="F_InvalidReason" value="9" />撞单
                                <br />
                                <input type="radio" name="F_InvalidReason" value="10" />其他
                                <input type="radio" name="F_InvalidReason" value="11" />重复数据
                            </td>
                        </tr>
                        <tr>
                            <td class="formTitle">备注</td>
                            <td class="formValue" colspan="5">
                                <textarea rows="3" id="F_Mark" class="form-control" placeholder="备注" style="width:90%;"></textarea>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>

        </table>
    </form>
</div>

<script>
    $('[name="F_State"]').click(function () {
        var val = $(this).val();

        if (val == '1') {
            $('#tr_reason').hide();
        } else {
            $('#tr_reason').show();
        }
    });
</script>